﻿@model IEnumerable<tutors_clus.Models.message>

@{
    ViewBag.Title = "Detail_Message";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


        <div class="postbody">
            @foreach (var item in Model)
            {
                <div class="postbodytop">
                    <h2>@item.title_mes</h2>
                </div>
                <div class="infoAuthor"><span>
                        @{
                            if(@item.isrepply == true)
                            {
                                @item.course.teacher.fullname_tea
                            }else
                            {
                                if (@item.student.id_stu == WebSecurity.GetUserId(User.Identity.Name))
                                {
                                    <i>Bạn</i>
                                }
                                else
                                {
                                    @item.student.fullname_stu
                                }
                                
                            }
                            
                        }
                 </span>đã gửi @item.createdate_msg</div>
                <div class="postcontent">@MvcHtmlString.Create(item.content_mes)
                    <h3>File đính kèm</h3>
                    <ul>
                    @foreach (var item2 in item.message_file)
                    {
                    
                            <li>
                                <a href="@item2.file_attach.source">@item2.file_attach.name</a>
                            </li>
                    
                    }
                    </ul>
                    
                </div>

            }
        </div>
        <div class="repost">
            <div class="count_com">
                    <div class="count_com">
                        <h2>@ViewBag.count bình luận</h2>
                    </div>
                    <hr />
                    @foreach (var item2 in ViewBag.detail_msg)
                    {
                        <div class="repostbody">
                        <div class="infoAuthor"><span>
                           @{
                            if(@item2.isrepply == true)
                            {
                                @item2.course.teacher.fullname_tea
                            }else
                            {
                                //if (@item2.student.id_stu == WebSecurity.GetUserId(User.Identity.Name))
                                //{
                                    <i>Bạn</i>
                                //}
                                //else
                                //{
                                  //  @item2.student.fullname_stu
                                //}
                                
                            }
                        }
                        </span> đăng vào @item2.createdate_msg</div>
                    
                        <div class="postcontent">@MvcHtmlString.Create(item2.content_mes)
                            
                                <h3>File đính kèm</h3>
                                <ul>
                                @foreach (var item3 in item2.message_file)
                                {
                    
                                        <li>
                                            <a href="@item3.file_attach.source">@item3.file_attach.name</a>
                                        </li>
                    
                                }
                                </ul>
                                
                         
                            
                        </div>
                    </div>  
                    }
                </div>
                <hr />
        </div>
        <div class="recomment">
            @using (Html.BeginForm("Reply_msg", "Student", new { id_cou = Model.Select(m => m.id_cou).FirstOrDefault(), id_msg = Model.Select(m => m.id_mes).FirstOrDefault() }, FormMethod.Post, new { @encType = "multipart/form-data" }))
            {
                    <input type="text" name="contentMsg" placeholder="Nội dung tin nhắn"  />
                    <br />
                    <input type="file" multiple="" name="fileuploads" value="" />
                    <input type="submit" name="name" value="Trả lời" />
            }
        </div>
